/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.yourtrade.model;

import lombok.Data;

/**
 *
 * @author xg
 */
@Data
public class AjaxResponse extends ReturnResult {

    /**
     * 返回数据
     */
    private final Object model;

    public AjaxResponse() {
        this(true);
    }

    public AjaxResponse(boolean success) {
        this(success, "");
    }

    public AjaxResponse(boolean success, String message) {
        this(success, message, null);
    }

    public AjaxResponse(boolean success,
                        String message,
                        Object model) {
        super(success, message);
        this.model = model;
    }

    public static AjaxResponse fromReturnResult(ReturnResult result) {
        return new AjaxResponse(result.isSuccess(), result.getMessage(), null);
    }
}

